<?php
	require("libraries/student.php");
	class Request extends Student{
		public function __construct(){
			parent::__construct();
			$this->load->model("model_request");
		}
		public function index(){
			$config['base_url'] = base_url().'admin/request/index/';
			$config['total_rows'] = $this->model_request->count_all();
			$config['per_page'] = 10;
			$config['uri_segment'] = 4;
			$this->load->library("pagination");
			$this->pagination->initialize($config); 
			$start = $this->uri->segment(4);
			$data['title']= "Manage Request Customer";
			$data['data']['info']= $this->model_request->listorder($config['per_page'],$start);
			$data['template'] = "request/list_request";
			$this->load->view("layout",$data);
		}
		public function request_view(){
			$data['title']= "Manage Request Customer";
			$data['template'] = "request/request_view";
			$data['data'] = "";
			$data['all'] = $this->model_request->request_view($this->uri->segment(4));	
			$this->load->view("layout",$data);		
		}
        public function active(){
            $id   	= $this->uri->segment(4);
            $status	= $this->uri->segment(5);
            $db = array(
                "request_status" => $status
            );
            $this->model_request->update_status($db,$id);
            redirect(base_url()."admin/request/");
        }
		public function del(){
			$id = $this->uri->segment(4);
			$this->model_request->del($id);
			redirect(base_url()."admin/order");
		}
	}